#ifndef LOGINQUERY_H
#define LOGINQUERY_H
#include <QObject>
#include <QString>
#include <QNetworkAccessManager>
#include <QNetworkReply>

//namespace GUI
//{

    class LoginQuery: public QObject
    {
        Q_OBJECT

    private:
        QNetworkAccessManager *manager;


        QString httpQuery;
        QString jsonQuery;

    public:

        LoginQuery(QObject *parent = 0);
        LoginQuery(QString user, QString password, QObject *parent = 0);
        void setQuery(QString user, QString password);

        ~LoginQuery();

        const QString& getHttpQuery();
        const QString& getJsonQuery();

        void doRequest();

    signals:
        void responseReceived(QString status, QString auth_token,QString status_description);
        void errorReceived();

    private slots:
        void onManagerFinished(QNetworkReply *reply);
        void onReplyError(QNetworkReply::NetworkError);
        void onManagerSslErrors();

    private:
        LoginQuery(const LoginQuery& obj);
        LoginQuery& operator=(const LoginQuery& obj);

    }; // class LoginQuery

//} // namespace GUI
#endif // LOGINQUERY_H
